{extend name="property/public/insidePageBase" /}
{block name="title"}编辑物业{/block}
{block name="css"}
{__block__}
<style>
    .layui-btn {
        padding: 0 8px;
    }
</style>
{/block}
{block name="body"}
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-form  layui-form-pane">
            <div class="layui-row">
                <div class="layui-col-xs5">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">物 业 简 称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="{$info['name']??''}" lay-verify="require" autocomplete="off" placeholder="请输入物业简称" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs7">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">物业缩略图</label>
                        <div class="layui-input-inline">
                            <input type="text" name="picture" value="{$info['picture']??''}" placeholder="请上传物业图片" id="picture" class="layui-input">
                        </div>
                        <img class="checkPictureByImg picture" src="{$info['picture']??''}" style="width: 38px;height: 38px;">
                        <div class="layui-input-inline layui-btn-container" style="width: 38px;height: 38px;">
                            <button type="button" class="layui-btn layui-btn-primary uploadImg" lay-data="{field: 'picture',data:{dir:'property/picture', field:'picture'}}">
                                <i class="layui-icon">&#xe67c;</i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs5">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">客 服 电 话</label>
                        <div class="layui-input-block">
                            <input type="text" name="service_tel" value="{$info['service_tel']??''}" lay-verify="require" autocomplete="off" placeholder="请输入客服电话" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs7">
                    <div class="layui-form-item">
                        <label class="layui-form-label indispensable">客服二维码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="service_code" value="{$info['service_code']??''}" placeholder="请上传客服二维码" id="service_code" class="layui-input">
                        </div>
                        <img class="checkPictureByImg service_code" src="{$info['service_code']??''}" style="width: 38px;height: 38px;">
                        <div class="layui-input-inline layui-btn-container" style="width: 38px;height: 38px;">
                            <button type="button" class="layui-btn layui-btn-primary uploadImg" lay-data="{field: 'service_code',data:{dir:'property/service_code', field:'service_code'}}">
                                <i class="layui-icon">&#xe67c;</i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">物业标签</label>
                <div class="layui-input-block">
                    <input type="text" name="label_id" id="label" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label">物 业 编 码</label>
                        <div class="layui-input-block">
                            <input type="text" disabled value="{$info['code']??''}" minlength="5" maxlength="5"  lay-verify="require" autocomplete="off" placeholder="请输入物业编码" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-input-group">
                        <div class="layui-input-split layui-input-prefix">占地面积</div>
                        <input type="text" name="cover_area" value="{$info['cover_area']??''}"  placeholder="占地面积"  class="layui-input">
                        <div class="layui-input-split layui-input-suffix">㎡</div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-input-group">
                        <div class="layui-input-split layui-input-prefix">建筑面积</div>
                        <input type="text" name="building_area" value="{$info['building_area']??''}"  placeholder="建筑面积"  class="layui-input">
                        <div class="layui-input-split layui-input-suffix">㎡</div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label indispensable">所 属 地 址</label>
                <div class="layui-input-block">
                    <div class="layui-input-inline" style="width: 398px;">
                        <input type="text" name="address" value="{$info['address']??''}" id="address" placeholder="请输入所属地址" class="layui-input" autocomplete="off"/>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn" type="button" id="map_location"><i class="layui-icon layui-icon-location"></i>定位</button>
                    </div>
                </div>
            </div>
			<div class="layui-form-item layui-form-text">
			    <label class="layui-form-label">备注说明</label>
			    <div class="layui-input-block">
			      <textarea name="remark"  placeholder="请输入备注说明" class="layui-textarea">{$info['remark']??''}</textarea>
			    </div>
			</div>
            <div class="layui-form-item layui-hide">
                <input type="hidden" name="longitude" id="longitude" value="{$info['longitude'] ?? ''}" />
                <input type="hidden" name="latitude" id="latitude" value="{$info['latitude'] ?? ''}" />
                <button class="layui-btn" lay-submit lay-filter="submitBtn" id="submitBtn">提交</button>
            </div>
        </div>
    </div>
</div>
{/block} {block name="js"} {__block__}
<script>
    layui.use(['form', 'layer','layCascader', 'laytpl'], function () {
        var form = layui.form,layer = layui.layer,  $ = layui.$,layCascader = layui.layCascader, laytpl = layui.laytpl;
        setTimeout(function() {
            let labelCase = layCascader({
                elem: '#label',
                options: {:json_encode($labelData,JSON_UNESCAPED_UNICODE)},
                value: {:json_encode($info['label_ids'],JSON_UNESCAPED_UNICODE)},
                props: {
                    multiple: true
                }
            });
        }, 200)
        $('.uploadImg').selectImages({
            confirm:function(res,elem,data) {
                $('#' + data.field).val(res[0].src);
                $('.' + data.field).attr('src',res[0].src)
            }
        });

        $('#map_location').on('click', function() {
            parent.layer.open({
                type: 2,
                title: '定位',
                content: "/static/maplocation/index.html?lat={$info['latitude']}&lng={$info['longitude']}",
                area: ['90%', '90%'],
                btn: ['确认','取消'],
                yes: function(index, layero){
                    choseeArea = parent.window.frames['layui-layer-iframe'+index].choseeArea;
                    if(choseeArea === undefined) {
                        return parent.layer.msg('请选择地区');
                    }
                    $('#address').val(choseeArea.regeocode.formattedAddress);
                    $('#latitude').val(choseeArea.lnglat.lat);
                    $('#longitude').val(choseeArea.lnglat.lng);
                    console.log(choseeArea);
                    parent.layer.close(index);
                }
            });
        });
    });
</script>
{/block}